Remove size on floating point data types during MySQL field normalization#110
Open
jpiautinity wants to merge 1 commit intodbsrgits:masterfrom
Open
Remove size on floating point data types during MySQL field normalization#110jpiautinity wants to merge 1 commit intodbsrgits:masterfrom
jpiautinity wants to merge 1 commit intodbsrgits:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #110 +/- ##
==========================================
+ Coverage 21.5% 21.51% +0.01%
==========================================
Files 71 71
Lines 19914 19917 +3
Branches 5728 5729 +1
==========================================
+ Hits 4283 4286 +3
- Misses 14922 14924 +2
+ Partials 709 707 -2
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This merge request removes the forced 2 precision and 8 digits size limit for floating point number data types in the MySQL field normalization and instead force removes size for these data types.
Some unit tests are updated to reflect this change.
Reason for this change:
While sane size limits are useful for fixed point data types like decimal such limits make little sense for floating point data types. Setting the size for floating point data types does not result in less storage being used but will just try to badly truncate the input and mask the output (or raise an error in strict mode on bad input).
For use cases where size restricted data is required or desired it is highly recommended to use fixed point data types as they don't have impression errors in their given number space as opposed to IEEE 754 floating point numbers (As an example: 0.1 and 0.2 are not directly representable as IEEE 754 number no matter how good the precision is). IEEE 754 floating point numbers are simply not designed for such use cases but to closer approximate natural numbers.
Being able to set size limits to floating point numbers can also encourage the use of bad practices like the classic case of money represented as floating point numbers.
Lastly, the MySQL documentation recommends not using precision and number of digits for maximum portability.
https://dev.mysql.com/doc/refman/en/floating-point-types.html